Day 14 - Regular expressions - Classes

84

$ cat examples.txt | grep "a[a-z]"

cat

elephant

dryad

aardvark

phase spider

manticore

undead red dragon

Spider-Man [*]

cat

basilisk

hogwash

cat

Big Bad Wolf

Go back to the exercise

Exercise 14.09

Match any line of examples.txt containing an upper case letter followed by a digit

Solution

$ cat examples.txt | grep "[A-Z][0-9]"

H2O

R2-D2

Go back to the exercise

Exercise 14.10

Match any line of examples.txt containing a dash

Solution